﻿using NewLife.Http;
using Quartz;
using ZYing.QPanel.Http;

namespace ZYing.QPanel
{
    public class QPanelHttpServer : HttpServer
    {
        public QPanelHttpServer(IScheduler scheduler)
        {
            if (scheduler == null) throw new System.ArgumentNullException(nameof(scheduler));
            this.Environment = new QPanelEnvironment(scheduler);
            this.RegisterController();
        }
        public QPanelEnvironment Environment { get; }
        private void RegisterController()
        {
            string key = "/api/*";
            this.Routes[key] = new AsyncControllerHandler<HttpQuartzApiService>(() => new HttpQuartzApiService(this.Environment));
        }
    }
}